<template>
  <div class="w750 white-bg">
    <header>
      <div class="header-box">
        <div class="header-back" @click="goback">
          <span class="back-img"><img src="../../../assets/images/back.png" alt=""></span>
        </div>
        <div class="header-search">
          <p class="ser-txt">跳转中</p>
        </div>
        <div class="header-mes">

        </div>
      </div>
    </header>
  </div>
</template>

<script>
  import { NavBar } from "vant";
  import {tokenManage} from 'utils/Cache';
  import { registerAgreement } from "api/register";
  import { applyPromoter , submitPromoter } from "api/extensionApi";
  export default {
    components: {
      NavBar
    },
    data() {
      return {
      }
    },
    mounted() {

      let that = this

      this.$toast.loading({
        duration: 1000,
        mask: true,
        message: '跳转中...'
      });

      if(tokenManage.isLogin()) {//如果已登录
        applyPromoter().then(res => {
          if(res.status == 1) {
            if(res.result.status == 1) {
              this.$router.replace({
                path: `/myExtension`,
                query: {
                  parentUserName: this.$route.query.parentUserName
                }
              })
            } else {
              this.$router.replace({
                path: `/applyExtension`
              })
            }
          }else {
            this.$toast(res.msg)
          }
        })
      }else {
        this.$router.replace({
          path: `/register`,
          query: {
            parentUserName: this.$route.query.parentUserName
          }
        })
      }
    },
    methods: {
      //返回
      goback() {
        this.$router.isBack = true
        this.$router.back();
      },
    },
    computed: {

    }
  };
</script>


<style scoped>

</style>
